package com.example.designpattern.strategy_pattern.c;

import org.junit.Test;

/**
 * 测试类
 */
public class ClientTest {

    @Test
    public void myTest() throws Exception{
        MovieTicket movieTicket = new MovieTicket();
        double originalPrice = 60.0;
        System.out.println("原始价为：" + originalPrice);
        System.out.println("---------------------------------");

        movieTicket.setPrice(originalPrice);
//        Discount discount = new StudentDiscount();
        Discount discount = new ChildrenDiscount();
        //注入折扣对象
        movieTicket.setDiscount(discount);

        double currentPrice = movieTicket.getPrice();
        System.out.println("折后价为：" + currentPrice);
    }
}
